/*
 * WScheduleEntryRenderer.java
 * 
 *  author: Daniel Rudigier
 *    date: 27.06.2008
 * 
 * 
 */
package ocumed.web.jsf;

import javax.faces.context.FacesContext;

import ocumed.web.jsf.model.WScheduleEntry;

import org.apache.myfaces.custom.schedule.HtmlSchedule;
import org.apache.myfaces.custom.schedule.model.ScheduleEntry;
import org.apache.myfaces.custom.schedule.renderer.DefaultScheduleEntryRenderer;

/**
 * @author Daniel Rudigier
 *
 */
public class WEntryRenderer extends DefaultScheduleEntryRenderer {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private static final String colorPrivate = "rgb(50,50,50)";
    private static final String colorPublic = "rgb(100,10,50)";
    
    
    
    /**
     * override
     *
     * @see org.apache.myfaces.custom.schedule.renderer.DefaultScheduleEntryRenderer#getColor(javax.faces.context.FacesContext, org.apache.myfaces.custom.schedule.HtmlSchedule, org.apache.myfaces.custom.schedule.model.ScheduleEntry, boolean)
     */
    @Override
    public String getColor(FacesContext context, HtmlSchedule schedule,
            ScheduleEntry entry, boolean selected) {
        
        if (entry instanceof WScheduleEntry) {
            WScheduleEntry e = (WScheduleEntry) entry;
            
            if (e.isPrivate()) {
                return colorPrivate;
            } else {
                return colorPublic;
            }         
        } else {
            return super.getColor(context, schedule, entry, selected);
        }
    }

}
